package com.highcom;

import com.alibaba.druid.pool.DruidDataSource;
import com.highcom.config.SpringConfig;
import com.highcom.dao.BookDao;
import com.highcom.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        //ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        //BookDao bookDao = (BookDao)ctx.getBean("bookDao");
        //System.out.println(bookDao);

        //String b1 = (String)ctx.getBean("b1");
       // System.out.println("b1 = " + b1);

        //DruidDataSource dataSource = (DruidDataSource)ctx.getBean("dataSource");
        //System.out.println("dataSource = " + dataSource);

        //BookDao bookDao = (BookDao)ctx.getBean("bookDao");
        //bookDao.save();

        UserService userService = (UserService)ctx.getBean("userService");
        userService.save();
    }
}